#include "random.h"

#include <time.h>
#include <stdlib.h>

void rand_init() {
	static int initialized = 0;
	if(initialized) return;
	
	srand(time(NULL));
	initialized = 1;
}

float rand_unit() {
	rand_init();
	return rand() / (float)RAND_MAX;
}

float rand_range(float a, float b) {
	return rand_unit() * (b - a) + a;
}